﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using TrainingWorkshop.Model;

namespace TrainingWorkshop.NewDAL
{
    public class SqlFactory : IFactory
    {
        private SqlConnection ConnectObject;

        public SqlFactory(String TConnectionString)
        {
            ConnectObject = new SqlConnection(TConnectionString);
        }

        public SqlConnection GetConnectObject()
        {
            return ConnectObject;
        }
  

        public ITeacherRepository CreateTeacherRepository()
        {
            ITeacherRepository teacherRepository = new TeacherRepository(ConnectObject);
            return teacherRepository;
        }

        public IDepartmentRepository CreateDepartmentRepository()
        {
            IDepartmentRepository departmentRepository = new DepartmentRepository(ConnectObject);
            return departmentRepository;
        }

        public IDepartmentAndTeacherRepository CreateDepartmentAndTeacherRepository()
        {
            IDepartmentAndTeacherRepository DepartmentAndTeacherRepository = new DepartmentAndTeacherRepository(ConnectObject);
            return  DepartmentAndTeacherRepository;
        }
    }
}
